package com.yuyou.train.gateway;

import java.util.Map;

import org.springframework.boot.autoconfigure.web.DefaultErrorAttributes;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;

import com.yuyou.train.util.bean.ReturnCode;
import com.yuyou.train.util.bean.ReturnResult;

@Component
public class DefindErrMess extends DefaultErrorAttributes {
    @Override
    public Map<String, Object> getErrorAttributes(RequestAttributes requestAttributes, boolean includeStackTrace) {
    	Map<String, Object> result = super.getErrorAttributes(requestAttributes, includeStackTrace);
    	ReturnResult<String> res=new ReturnResult<String>(false,null,null,ReturnCode.code._2002.getCode(),ReturnCode.code._2002.getMessage()+":"+result);	
        return res.toMap();
    }
}